<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text">
        <button class="b1">存储</button>    
        <button class="b2">取出</button>    
        <button class="b3">删除</button>    
           <script>
               var b1 = document.querySelector('.b1')
               var b2 = document.querySelector('.b2')
               var b3 = document.querySelector('.b3')
               var inp = document.querySelector('input')
               b1.addEventListener('click',function(){
                       sessionStorage.setItem('uname',inp.value);
               })
               b3.addEventListener('click',function(){
                    //    sessionStorage.setItem('uname',inp.value);
                    sessionStorage.removeItem('uname');
               })
               b2.addEventListener('click',function(){
                     var name =   sessionStorage.getItem('uname');
                     console.log(name);
                     inp.value = name;
                     
               })
           </script>
</body>
</html>